export class freightSet {
  id?: number;
  name = '';
  type = 1
  appoint = false
  sort = 0
  region: Iregion[] = []
  free: Ifee[] = []

  constructor(data?: freightSet) {
    data && this.setProps(data);
  }

  setProps(data: freightSet) {
    (Object.keys(this) as Array<keyof IfreightSet>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type IfreightSet = Omit<freightSet, 'setProps'>


export class region {
  city_ids = []
  first = 0
  firstPrice = 0
  renewal = 0
  renewalPrice = 0
  cityId?: string
  title?: string
  constructor(data?: region) {
    data && this.setProps(data);
  }

  setProps(data: region) {
    (Object.keys(this) as Array<keyof Iregion>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type Iregion = Omit<region, 'setProps'>

export class fee {
  city_ids = []
  number = 0
  price = 0
  cityId?: string
  title?: string
  constructor(data?: fee) {
    data && this.setProps(data);
  }

  setProps(data: fee) {
    (Object.keys(this) as Array<keyof Ifee>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type Ifee = Omit<fee, 'setProps'>